package com.woniuxy.hospital.mapper;

import com.woniuxy.hospital.entity.HplAdmin;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.woniuxy.hospital.entity.HplPerm;
import org.apache.ibatis.annotations.Select;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author jobob
 * @since 2021-08-12
 */
public interface HplAdminMapper extends BaseMapper<HplAdmin> {

    /**
     * 根据管理员ID获取权限
     * @param admin_id
     * @return List<HplPerm>
     */
    @Select("SELECT*FROM hpl_perm p,hpl_role_perm rp,hpl_admin_role ar " +
            "WHERE p.id=rp.perm_id AND rp.role_id=ar.role_id AND ar.admin_id=#{admin_id}")
    List<HplPerm> getPermsByAdminId(int admin_id);
}
